package com.cmict.data.system.api.permission;

import com.cmict.data.framework.common.pojo.CommonResult;
import com.cmict.data.system.api.permission.dto.MenuDTO;
import com.cmict.data.system.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 权限 API 接口
 *
 * @author awesome
 */
@FeignClient(name = ApiConstants.NAME)
@Api(tags = "RPC 服务 - 角色")
public interface MenuApi {
    String PREFIX = ApiConstants.PREFIX + "/menu";

    /**
     * 表单发布删除菜单
     *
     * @param id 菜单编号
     */
    @PostMapping(PREFIX + "/delete")
    @ApiOperation("删除表单菜单")
    @ApiImplicitParam(name = "id", value = "菜单id", example = "1", required = true, allowMultiple = true)
    CommonResult<Boolean> deleteMenuForm(@RequestParam("id")Long id);

    /**
     * 获得菜单
     *T
     * @return 菜单
     */
    @PostMapping(PREFIX + "/list")
    @ApiOperation("获取菜单集合")
    CommonResult<List<MenuDTO>> getMenus();

    /**
     * 获得菜单-根据id
     *T
     * @return 菜单
     */
    @PostMapping(PREFIX + "/getFromId")
    @ApiOperation("获取当前菜单")
    @ApiImplicitParam(name = "id", value = "菜单id", example = "1", required = true, dataTypeClass = Long.class)
    CommonResult<MenuDTO> getFromId(@RequestParam("id")Long id);
}
